package com.module.app.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;


import com.module.app.utils.GsonUtils;
import com.module.app.utils.GsonUtils;
import com.module.base.utils.LogUtils;
import com.module.third.bean.push.Push;
import com.module.third.bean.push.PushData;

/**
 * 消息通知
 * 接收"action":"com.privates.club.data" 的消息
 * 切换到后台无法接受推送
 */
public class MyPushReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        LogUtils.e("接收到推送");
        // 获取推送消息数据
        String message = intent.getStringExtra("com.avoscloud.Data");
        Push push = GsonUtils.fromJson(message, Push.class);
        if (push == null || push.getData() == null) {
            return;
        }
        PushData pushData = push.getData();
        PushDealUtils.Companion.dealPush(context, pushData);

    }
}
